atspiroot: Don't leak references
authorMatthias Clasen <mclasen@redhat.com>
Fri, 9 Oct 2020 22:21:15 +0000 (18:21 -0400)
committerEmmanuele Bassi <ebassi@gnome.org>
Mon, 12 Oct 2020 15:19:32 +0000 (16:19 +0100)
The reffing getter trap, lurking behind g_list_model_get_item().

gtk/a11y/gtkatspiroot.c

index 3f64ebf82c544cd125694434ec82169ebc1947cd..e8f7ef881709798283f40dcf41e675cb62bd791e 100644 (file)
@@ -281,6 +281,8 @@ handle_accessible_method (GDBusConnection       *connection,
         {
           window = g_list_model_get_item (self->toplevels, i);
 
+          g_object_unref (window);
+
           if (!gtk_widget_get_visible (window))
             continue;
 
@@ -335,6 +337,8 @@ handle_accessible_get_property (GDBusConnection       *connection,
 
           if (gtk_widget_get_visible (window))
             n_children += 1;
+
+          g_object_unref (window);
         }
 
       res = g_variant_new_int32 (n_children);